{% extends "base.html" %}
{% load static %}
{% block title %} 更新文章 {% endblock title %}

{% block content %}
    <div class="container">
        <div class="row">
            <div class="col-12">
                <br>
                <form method="post" action="." enctype="multipart/form-data">
                    {% csrf_token %}
                    <div class="form-group">
                        <label for="title">文章标题</label>
                        <input type="text" class="form-control" id="title" name="title" value="{{ article.title }}">
                    </div>
                    <div class="form-group">
                        <label for="body">文章正文</label>
                        <textarea class="form-control" id="body" name="body"
                                  rows="12">{{ article.body|safe }}</textarea>
                    </div>
                    <button type="submit" class="btn btn-primary">完成</button>
                </form>
            </div>
        </div>
    </div>

    <!-- ✅ 引入 CKEditor -->
    <script src="{% static 'ckeditor/ckeditor-init.js' %}"></script>
    <script src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script>

    <script>
        CKEDITOR.replace('body', {
            removePlugins: 'notification',
            filebrowserUploadUrl: '/ckeditor/upload/',
            filebrowserBrowseUrl: '/ckeditor/browse/',
            height: 400,
        });
    </script>

{% endblock content %}
